﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;

namespace Tunneler.Tools {
    class Cooldown {
        private GameTime gameTime;
        private double cdLength;

        private double deactivationTime;

        public double Length { get { return cdLength; } }

        public Cooldown(GameTime gameTime, double miliseconds) {
            this.gameTime = gameTime;
            this.cdLength = miliseconds;
        }

        public void Use() {
            deactivationTime = gameTime.TotalGameTime.TotalMilliseconds + cdLength;
        }

        public bool IsCool() {
            double curTime = gameTime.TotalGameTime.TotalMilliseconds;
            return deactivationTime < curTime;
        }

        public bool IsHot() {
            double curTime = gameTime.TotalGameTime.TotalMilliseconds;
            return deactivationTime >= curTime;
        }
    }
}
